import java.util.*;

/**
 * 牛客 数据库连接池
 * https://www.nowcoder.com/questionTerminal/05f97d9b29944c018578d98d7f0ce56e
 */
public class Demo1 {
    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int n  = sc.nextInt();
            int max = 0;
            Set<String> set = new HashSet<>();
            for (int i = 0; i < n; i++) {
                String id = sc.next();
                String operate = sc.next();
                if(operate.equals("connect")) {
                    set.add(id);
                }else {
                    set.remove(id);
                }
                max = Math.max(max,set.size());
            }
            System.out.println(max);
        }
    }
}
